- use of complex value type in Xi -
Xi supports the complex value type in almost all numerical functions. Exceptions are special functions like the bessel function. If no method for complex types is available, Xi converts the complex to double. Define a complex variable like this
( 1)>complex a=(1, 0); /* a=1+0*i */ ( 2)>complex b=(2,-1); /* b=2-1*i */ ( 3)>c={ { (2,-1), (3,2) },{ a, b }}; ( 4)>print(c); <cpxarr> (2, -1) (3, 2) (1, 0) (2, -1)The real (imaginary) part of a complex number can be obtained by
( 5)>re=real(a); ( 6)>im=imag(a);Also to compute the complex conjugate of an input variable type
( 7)>c=conj(c);